package com.damuzee.system.admin.action;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.mybatis.sql.page.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.damuzee.core.web.session.SessionProvider;
import com.damuzee.system.admin.domain.EmpUser;
import com.damuzee.system.admin.domain.TipMsg;
import com.damuzee.system.admin.service.AgentAcctService;
import com.damuzee.system.admin.service.TipMsgService;
import com.damuzee.system.admin.web.RequestUtil;

@Controller
public class MsgCenterAct {

	private static final Logger log = LoggerFactory .getLogger(MsgCenterAct.class);
	
	
	@RequestMapping("/msgcenter/v_center.do")
	public String center(){
		
		return "/msgcenter/center" ;
	}
	
	
	@RequestMapping("/msgcenter/v_left.do")
	public String left(){
		
		return "/msgcenter/left" ;
	}
	
	@RequestMapping("/msgcenter/v_list.do")
	public String list(Integer pageNo,HttpServletRequest request, HttpServletResponse response,
			ModelMap model){
		
		Page<TipMsg> page = new Page<TipMsg>();
		page.setCurrentPage(0);
		page.setCurrentPage(pageNo);
		
		TipMsg msg = new TipMsg();
		EmpUser user = RequestUtil.getUser();
		msg.setCheckUser(user.getId());
		page = tipMsgService.getTipMsgByPage(page,msg);
		
		model.addAttribute("page", page.getPage());
		return "/msgcenter/list" ;
	}
	
	@Autowired
	private AgentAcctService agentAcctService;
	@Resource
	private SessionProvider session;
	@Resource 
	private TipMsgService tipMsgService ;
}
